#ifndef GRAMMARANALYZER_H
#define GRAMMARANALYZER_H


#include <string>
#include "WordAnalyzer.h"
#include "SymbolTable.h"
#include "TemporaryCodeGenerator.h"

struct GrammarNode {
	int type;
	int intVal;
	double doubleVal;
	std::string strVal;
};
#define YYSTYPE struct GrammarNode

class GrammarAnalyzer {
	//词法分析器：
	WordAnalyzer wa;
	SymbolTable *pST;
	TemporaryCodeGenerator *pTCG;
	
	int yyparse(void);
	
public:
	GrammarAnalyzer(const std::string &srcFileName);
	int parse(SymbolTable *pST, TemporaryCodeGenerator *pTCG=NULL);
};
	
	
		



#endif
